/*--------------------------------------------------------------------------------
file: MsgRounter.h
use	: 封装一个消息路由类,。 根据消息cmd， 把消息发给不同对象
ver :
	1.0 by whc. at 2016-3-20. anything call me.
memo:
--------------------------------------------------------------------------------*/

#ifndef MSGROUNTER_H
#define MSGROUNTER_H

#include <iostream>
#include <map>

#include "../Frame/Message.h"
#include "../Frame/Debug.h"
#include "System/GameServerInfo.h"

using namespace std;

class MsgRounter
{
	public:
		MsgRounter();
		~MsgRounter();

		void ServerRounter(Message* _pMsg);
		void ServerInit();
		void ServerAllRegister();

		void ClientRounter(Message* _pMsg);
		void ClientInit();
		void ClientAllRegister();

	private:
		typedef void (*pFunc)(Message* _pMsg);

		bool m_isServerInit;
		std::map<eCmd, pFunc> m_ServerMsgCallMap;

		bool m_isClientInit;
		std::map<eCmd, pFunc> m_ClientMsgCallMap;

};

#endif // MSGROUNTER_H
